﻿using System;
using System.ComponentModel;

namespace DBService
{
	public class SectionParameter
	{
		[Category("属性")]
		[Description("截面参数1。矩形截面此参数表示截面高度,圆形截面此参数表示截面半径")]
		[DisplayName("截面参数1")]
		public double Parameter1
		{
			get
			{
				return this.p1;
			}
			set
			{
				this.p1 = value;
			}
		}

		[Category("属性")]
		[Description("截面参数2。矩形截面此参数表示截面款度,圆形截面此参数无意义")]
		[DisplayName("截面参数2")]
		public double Parameter2
		{
			get
			{
				return this.p2;
			}
			set
			{
				this.p2 = value;
			}
		}

		[Category("属性")]
		[Description("截面类型")]
		[DisplayName("截面类型")]
		public SectionType SectionType
		{
			get
			{
				return this.sType;
			}
			set
			{
				this.sType = value;
			}
		}

		public SectionParameter(double param1, double param2)
		{
			this.p1 = param1;
			this.p2 = param2;
			this.sType = SectionType.Rect;
		}

		public SectionParameter(double param)
		{
			this.p1 = param;
			this.sType = SectionType.Arc;
		}

		public override string ToString()
		{
			string result;
			if (this.sType == SectionType.Arc)
			{
				result = string.Format("{0}({1})", "圆形", this.p1.ToString());
			}
			else
			{
				result = string.Format("{0}({1},{2})", "矩形", this.p2.ToString(), this.p1.ToString());
			}
			return result;
		}

		private double p1;

		private double p2;

		private SectionType sType;
	}
}
